import { createRouter, createWebHistory } from 'vue-router';
//import HomeView from '../views/HomeView.vue';
import FilmView from '../views/FilmView.vue';
import CinemaView from '../views/CinemaView.vue';
import  NewsView from '../views/NewsView.vue';
import MineView from '../views/MineView.vue';
import NowPlaying from '../components/film/NowPlaying.vue';
import ComingSoon from '../components/film/ComingSoon.vue';
import Cities from "../views/Cities.vue";
import Detail from '../components/film/Detail.vue';
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/film",
      redirect: "/film/nowPlaying",
   },
    {
      path: '/film',
      name: 'film',
      meta: { title: "电影", isTabPage: true },
      component: FilmView,
      //路由子组件
      children: [
        {
          // 当 /film/nowPlaying 匹配成功
          // NowPlaying 将被渲染到 FilmView 的 <router-view> 内部
          path: "nowPlaying",
          component: NowPlaying,
        },
        {
          // 当 /film/comingSoon 匹配成功
          // ComingSoon 将被渲染到 FilmView 的 <router-view> 内部
          path: "comingSoon",
          component: ComingSoon,
        },
      ],
    },
    {
      path:"/film/:id(\\d{4})",
      name:"detail",
      meta: { hideTabBar: true },
      component:Detail
    },
    {
      path: '/cinema',
      name: 'cinema',
      meta: { title: "影院", isTabPage: true },
      component: CinemaView
    },
    {
      path: '/news',
      name: 'news',
      meta: { title: "资讯", isTabPage: true },
      component: NewsView
    }, 
    {
      path: '/mine',
      name: 'mine',
      meta: { title: "个人中心", hideTitle: true },
      component:  MineView
    },
    {
      path: "/cities",
      name: "cities",
      meta: { title: "当前城市-", hideTabBar: true },
      component: Cities,
   },
  ]
})

export default router
